<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>资产管理</title>

    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="static/lib/css/bootstrap.min14ed.css">
    <link rel="stylesheet" href="static/lib/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="static/lib/css/animate.min.css">
    <link rel="stylesheet" href="static/lib/css/style.min862f.css">
    <link rel="stylesheet" href="static/lib/css/style.css">
    <script type="text/javascript" src="static/lib/plugins/vue/src/vue.js"></script>
</head>
<body class="fixed-sidebar full-height-layout gray-bg pace-done" style="overflow:hidden">
<div id="wrapper">
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="nav-close"><i class="fa fa-times-circle"></i>
        </div>
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <!--<span><img alt="image" class="img-circle" src="common/imgs/profile_small.jpg" /></span>-->
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <span class="clear" id="loginName">
                                <span class="text-muted text-xs block"><strong class="font-bold">{{loginname}}</strong></span>
                                <span class="text-muted text-xs block">超级管理员<!--<b class="caret"></b>--></span>
                            </span>
                        </a>
                    </div>
                </li>
            </ul>
        </div>
    </nav>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="ws">
        <span v-html="msg" v-show="false"></span>
    </div>
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <!--收缩-->
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                    <img src="common/imgs/logo_white.png" style="margin-top: 14px;">
                </div>
            </nav>
        </div>
        <!--tab标签-->
        <div class="row content-tabs">
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs J_menuTabs">
                <div class="page-tabs-content">
                    <a href="javascript:;" class="active J_menuTab" data-id="index_v1.html">首页</a>
                </div>
            </nav>
            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
            </button>

            <div class="btn-group roll-nav roll-right">

                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>

                </button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li class="J_tabShowActive"><a>定位当前选项卡</a>
                    </li>
                    <li class="divider"></li>
                    <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                    </li>
                    <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                    </li>
                </ul>
            </div>
            <a href="#" onclick="logout()" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
        </div>
        <!--iframe主题内容-->
        <div class="row J_mainContent" id="content-main">
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="login_default.html" frameborder="0" data-id="index_v1.html" seamless></iframe>
        </div>
        <!--footer底部-->
        <div class="footer">
            <div class="pull-right">© 国网电动汽车服务有限公司</div>
        </div>
    </div>
</div>
<script type="text/javascript" src="static/lib/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="static/lib/plugins/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="static/lib/plugins/metisMenu/jquery.metisMenu.js"></script>
<script type="text/javascript" src="static/lib/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="static/lib/plugins/layer/layer.min.js"></script>
<script type="text/javascript" src="static/lib/plugins/hplus.min.js"></script>
<script type="text/javascript" src="static/lib/plugins/pace/pace.min.js"></script>
<script src="static/js/public.js"></script>
<script src="static/js/index_left_menu.js"></script>
<script>
    var logVue = new Vue({
        el:"#loginName",
        data:{
            loginname:"",
        },
        methods:{
            getLoginName:function(){
                $.ajax({
                    url: projectPath + '/login/getCurrentUser',
                    type: 'GET',
                    dataType: 'json',
                    success:function (data) {
                        logVue.loginname = data.data.fullname;
                    }
                });
            },
        },
        mounted: function(){
            this.$nextTick(function(){
                this.getLoginName();
            });
        }
    });

    /*<![CDATA[*/
    var websocket = null;
    var wsVue = new Vue({
        el: '#ws',
        data: {
            msg: "welcome to cmd executor...<br/>"
        },
        mounted: function(){
            initWs();
        }
    });
    function initWs() {
        //check if your browser supports WebSocket
        if ('WebSocket' in window) {
            websocket = new WebSocket('ws://' + window.location.host+'/app_asset_of_stake/workorder/websocket');
        }
        else {
            alert('Sorry, websocket not supported by your browser.')
        }
        //Error callback
        websocket.onerror = function () {
            setMessageContent("error!");
            wsVue.opened = false;
        };
        //socket opened callback
        websocket.onopen = function (event) {
            setMessageContent("websocket opened");
            wsVue.opened = true;
        }
        //message received callback
        websocket.onmessage = function (event) {
            setMessageContent(event.data);
        }
        //socket closed callback
        websocket.onclose = function () {
            setMessageContent("websocket closed");
            wsVue.opened = false;
        }
        //when browser window closed, close the socket, to prevent server exception
        window.onbeforeunload = function () {
            websocket.close();
        }
    }
    //update message to vue and then in div
    function setMessageContent(content) {
        wsVue.msg = "websocket示例:" + content  + '<br/>';
    }
    //click to send message
    function executeCmd() {
        var message = document.getElementById('text').value;
        websocket.send(message);
    }
    //click to send message
    function cleanup() {
        wsVue.msg='';
    }
    /*]]>*/

    function logout(){
        window.location.href = projectPath+"/login/logout";
    }
</script>
</body>
</html>